home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / init.d / kexec-load < prev    next >
Encoding:
Text File  |  2013-01-10  |  1.1 KB  |  61 lines

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:        kexec-load
  4. # Required-Start:
  5. # Required-Stop:    $local_fs $remote_fs kexec
  6. # Should-Stop:        autofs
  7. # Default-Start:
  8. # Default-Stop:        0 6
  9. # Short-Description: Load kernel image with kexec
  10. # Description:
  11. ### END INIT INFO
  12.  
  13. PATH=/usr/sbin:/usr/bin:/sbin:/bin
  14. NOKEXECFILE=/tmp/no-kexec-reboot
  15.  
  16. . /lib/lsb/init-functions
  17.  
  18. test -r /etc/default/kexec && . /etc/default/kexec
  19.  
  20. do_stop () {
  21.     test "$LOAD_KEXEC" = "true" || exit 0
  22.     test -x /sbin/kexec || exit 0
  23.     test "x`cat /sys/kernel/kexec_loaded`y" = "x1y" && exit 0
  24.  
  25.     if [ -f $NOKEXECFILE ]
  26.     then
  27.         /bin/rm -f $NOKEXECFILE
  28.         exit 0
  29.     fi
  30.  
  31.     REAL_APPEND="$APPEND"
  32.  
  33.     test -z "$REAL_APPEND" && REAL_APPEND="`cat /proc/cmdline`"
  34.     log_action_begin_msg "Loading new kernel image into memory"
  35.     if [ -z "$INITRD" ]
  36.     then
  37.         kexec -l "$KERNEL_IMAGE" --append="$REAL_APPEND"
  38.     else
  39.         kexec -l "$KERNEL_IMAGE" --initrd="$INITRD" --append="$REAL_APPEND"
  40.     fi
  41.     log_action_end_msg $?
  42. }
  43.  
  44. case "$1" in
  45.   start)
  46.     # No-op
  47.     ;;
  48.   restart|reload|force-reload)
  49.     echo "Error: argument '$1' not supported" >&2
  50.     exit 3
  51.     ;;
  52.   stop)
  53.     do_stop
  54.     ;;
  55.   *)
  56.     echo "Usage: $0 start|stop" >&2
  57.     exit 3
  58.     ;;
  59. esac
  60. exit 0
  61.